import { useCallback, useState } from "react";

/*
 * @Author: lmk
 * @Date: 2021-07-15 14:16:46
 * @LastEditTime: 2021-07-21 23:32:40
 * @LastEditors: lmk
 * @Description: project util function
 */
export const pullState =  {
  //pull loading state
  refresh:{
    normal: 0, 
    pull: 1, 
    drop: 2, 
    loading: 3, 
    success: 4, 
    failure: 5, 
  },
  load:{
    normal: 0, 
    pull: 1, 
    drop: 2, 
    loading: 3, 
    success: 4, 
    failure: 5, 
  }
}

/**
 * @param {*} init set text value
 */
 export function useBind(init) {
  let [value, setValue] = useState(init);
  let onChange = useCallback(event=> {
    setValue(event);
  }, []);
  return {
    value,
    onChange
  };
}